#ifndef TOOLMANAGER_H_
#define TOOLMANAGER_H_

#include "Mouse.h"
#include "Vertex.h"
#include "TextureManager.h"
#include "Skeleton.h"
#include "TileList.h"

class ToolManager
{
	bool leftClickDepressed;
	bool leftClickWasDepressed;
	bool rightClickDepressed;
	bool rightClickWasDepressed;
	bool saveKeyDepressed;
	bool saveKeyWasDepressed;
	bool savePoseKeyDepressed;
	bool savePoseKeyWasDepressed;
	bool upKeyDepressed;
	bool upKeyWasDepressed;
	bool downKeyDepressed;
	bool downKeyWasDepressed;
	bool rightArrowDepressed;
	bool rightArrowWasDepressed;
	bool leftArrowDepressed;
	bool leftArrowWasDepressed;
	bool lockKeyDepressed;
	bool lockKeyWasDepressed;
	bool displayKeyDepressed;
	bool displayKeyWasDepressed;
	
	int currentPose;
	TileList * tileList;
	List<Tile> * currentTile;
	Skeleton * skeleton;
	char * saveFile;
	
	TextureManager * textureManager;

	Bone * selectedBone;
	Mouse mouse;
	int textureIndex;
	double lastThoughtTimestamp;
	void LoadFile(char * fileName);
	int GetElementType(char * element);
	Bone * HandlePoseTag(Bone * parent, char * tag, int * pos);
	Bone * ReadBone(Bone * parent, char * tag, int * pos);
	
	public:
	bool exit;
	
	ToolManager(char * filename, char * saveFile);
	~ToolManager();
	
	void PrepareFrame();
	void Draw();
	void SetNormalUserInput(unsigned char key,int modifier, bool isDepressed);
	void SetUserInput(int key, int modifier, bool isDepressed);
	void SetUserInput(int key, bool isDepressed, float x, float y);
	void SetPassiveMouse(float x, float y);
	void SetActiveMouse(float x, float y);
	void HandleUserInput();
	void SaveData();
	void SavePose();
	void LeftClick();
	void LeftDrag();
};
#endif /*TOOLMANAGER_H_*/
